package org.example;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.LogManager;
import java.util.logging.Logger;

/**
 * 使用配置文件方式定义log
 */
public class JUCDemo4 {
    public static void main(String[] args) throws IOException {
        FileInputStream inputStream = new FileInputStream(new File("D:\\dev_projects\\anons\\javalog\\javalog\\java-log-jul\\src\\main\\resources\\logging.properties"));
        LogManager logManager = LogManager.getLogManager();
        logManager.readConfiguration(inputStream);
        // 获取日志记录对象
        Logger logger = Logger.getLogger("org.example.JUCDemo4");
        // 设置过滤器
        logger.setFilter(new MyLogFilter());
        logger.info(">>>> hello");
        logger.info(">>>> hello");
        logger.info(">>>> 暴力执法");
        logger.info(">>>> hello");

    }
}
